﻿using JiveMessenger.ViewModels;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Threading.Tasks;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236

namespace JiveMessenger.CustomControls
{
    public sealed partial class LoginControl : UserControl
    {
        public LoginControl()
        {
            this.InitializeComponent();
        }
        private async void AddServerFlyout_Opened(object sender, object e)
        {
            ((ViewModelLoginControl)this.DataContext).IsAddServerPopupOpen = true;
            Flyout f = this.AddServerButton.Flyout as Flyout;
            Border border = f.Content as Border;
            StackPanel panel = border.Child as StackPanel;
            panel.Opacity = 0;

            await Task.Delay(300);
            panel.Animate(0, 1, "Opacity", 300, 0);
        }

        private void AddServerFlyout_Closed(object sender, object e)
        {
            ((ViewModelLoginControl)this.DataContext).IsAddServerPopupOpen = false;
            this.TextBoxAddServer.Text = "";

        }
    }
}
